package mysql

import (
	"fmt"
	_ "github.com/go-sql-driver/mysql"
	"github.com/jmoiron/sqlx"
)

type QuotaYq struct {
}

var Db *sqlx.DB

// 初始化方法
func Conn() {

	database, err := sqlx.Open("mysql", "root:123456@tcp(127.0.0.1:3306)/golang-go")
	fmt.Println(database.Stats(), err)

	Db = database
}

func Select() {
	// 开启事务
	tx, err := Db.Begin()
	if err != nil {
		panic(err)
	}
	tx.Exec("id=?", 1)
	//tx, err := Db.Beginx()
	//var quotayq []QuotaYq
	// 将查询的结果存储到QuotaYq切片中
	//Db.Select(&quotayq, "")
	//exec, err := Db.Exec()

}
